package com.a16.yuejian.yuejian.model;

import com.a16.yuejian.yuejian.javabean.Follow;
import com.a16.yuejian.yuejian.listener.Listener;
import com.a16.yuejian.yuejian.service.MyFollowService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by 王子恒 on 2017/11/11.
 */

public class MyPersonalModel {
    private Retrofit retrofit;

    public MyPersonalModel(){
        retrofit =new Retrofit.Builder()
                .baseUrl("http://10.0.2.2:8080/neu_yuejian201/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public void allfollow(String userid, final Listener listener){
        MyFollowService myFollowService=retrofit.create(MyFollowService.class);
        Call<List<Follow>> call=myFollowService.allfollow(userid);
        call.enqueue(new Callback<List<Follow>>() {
            @Override
            public void onResponse(Call<List<Follow>> call, Response<List<Follow>> response) {
                listener.onResponse(response.body());
            }

            @Override
            public void onFailure(Call<List<Follow>> call, Throwable t) {

            }
        });
    }




}
